/*
 * @Author: syyao 
 * @Date: 2019-05-17 15:24:00 
 * @Last Modified by: syyao
 * @Last Modified time: 2019-06-12 21:12:53
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  // base: '/iSee/',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component:(resolve) => require(['./views/Home'], resolve)
    },
    {
      path: '/pictureHub',
      name: 'pictureHub',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      redirect:'/pictureHub/recommend',
      component: (resolve) => require(['./views/PictureHub'], resolve),
      children:[
        {
          name:'recommend',
          path:'/pictureHub/recommend',
          component:(resolve)=>require(['./components/pictureHub/recommend'],resolve)
        },
        {
          name:'follow',
          path:'/pictureHub/follow',
          component:(resolve)=>require(['./components/pictureHub/follow'],resolve)
        },
        {
          name:'other',
          path:'/pictureHub/other',
          component:(resolve)=>require(['./components/pictureHub/other'],resolve)
        },
        {
          name:'collect',
          path:'/pictureHub/collect',
          component:(resolve)=>require(['./components/pictureHub/collect'],resolve)
        },
        {
          name:'search',
          path:'/pictureHub/search',
          component:(resolve)=>require(['./components/pictureHub/search'],resolve)
        }
      ]
    },
    {
      path: '/personalHub',
      name: 'personalHub',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: (resolve) => require(['./views/PersonalHub'], resolve),
      children:[
        {
          path: ':HubId',
          name:'HubId',
          component:(resolve)=>require(['./components/personalHub/eachHub'],resolve)
        }
      ]
    },
    {
      path: '/person',
      name: 'person',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: (resolve) => require(['./views/Person'], resolve)
    },{
      path:'/error',
      name:'error',
      meta: {
          title: 'error'
      },
      component: (resolve) => require(['./views/error'], resolve)
  },{
    path: "*",
    redirect:'/error',
}
  ]
})
